<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>填写信息</title>
	<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
	<meta name="keywords" content="翻倍花，O2O，第三方推广，服务平台">
    <meta name="description" content="翻贝网致力于打造国内最具公信力的第三方推广和服务平台">
    <link rel="stylesheet" href="{{ env('CSS_DOMAIN') }}/css/public.css?v={{env('CSS_VERSION')}}">
    <script src="{{ env('JS_DOMAIN') }}/js/adaptation.js?v={{env('JS_VERSION')}}"></script>
    <style>
		.gotodown_icon{width: 10.8rem;float: left;height: 9.2rem;}
		.gotodown_infor{margin: 0.6rem;overflow: hidden;border-bottom: 1px solid #b2b2b2;padding: 0.3rem 0;margin-bottom: 0.4rem;}
		.gotodown_infor span{font-size: 0.5rem;float: left;}
		.gotodown_infor input{font-size: 0.5rem;float: left;margin: 0 0.7rem;background-color: transparent;color: #fff;}
		.gotodown_appbtn{width: 9.6rem;height: 1.2rem;background-color: #fff;color: #9955c6;font-size: 0.56rem;border-radius: 0.2rem;position: absolute;top: 0.5rem;left: 0.6rem;z-index: 1;opacity: 0;}
		.gotodown_appbtnp{width: 9.6rem;height: 1.2rem;background-color: #fff;color: #9955c6;font-size: 0.56rem;border-radius: 0.2rem;text-align: center;line-height: 1.2rem;position: absolute;top: 0.5rem;left: 0.6rem;}
		.prompt{text-align: center;font-size: 0.5rem;color: #f2f279;margin-top: 2.5rem;}
		#gotodown_phonenum{width: 5rem;}
		form{background-color: #8355a0;float: left;width: 100%;height: 8.2rem;}
		.gotodown_btn{position: relative;}
		.shopname{font-size: 0.55rem;color: #f2f279;text-align: center;width: 7rem;margin: 0 auto;}
		#prompt_word{width: 7rem;position: fixed;top: 40%;left: 50%;margin-left: -3.6rem;background: rgba(0,0,0,0.7);color: #fff;z-index: 100000;font-size: 0.5rem;text-align: center;display: none;padding: 0.2rem 0.3rem;}
    </style>
</head>
<body>
	<p id="prompt_word">我们将以语音电话的形式告知您验证码，请注意接听来电。</p>
	<img class="gotodown_icon" src="{{env('IMAGE_DOMAIN')}}images/shop/usergotodown_bg.jpeg" alt="">
	<form action="" method="">
	    <input type="hidden" name="userid" value="{{$userid}}" />
	    <p class="shopname">{{$nickname}}({{$mobile}})</p>
		<p class="gotodown_infor">
			<span class="co_white">手机号</span>
			<input id="gotodown_phonenum" type="text" name="mobile" value="" placeholder="请填写您的手机号" maxlength="11">
		</p>
		<p class="gotodown_infor" style="margin-top: 0.4rem;">
			<span class="co_white">验证码</span>
			<input style="width: 3rem;text-align: center;" type="text" name="code" value="" placeholder="请填写验证码" maxlength="6">
			<span id="getid_code" style="width: 3.6rem;text-align: center;color: #f2f279;">获取验证码</span>
		</p>
		<div class="gotodown_btn">
			<input class="gotodown_appbtn" type="button" name="" value="前往下载App">
			<p class="gotodown_appbtnp">前往下载App</p>
		</div>
		<p class="prompt"></p>
	</form>
<script src="{{env('JS_DOMAIN')}}js/jquery-1.11.1.min.js?v={{env('JS_VERSION')}}"></script>
<script>
	window.onresize=function(){
		pagesp();
    }
    if($('.shopname').html().length > 24){
    	var namenum = $('.shopname').html().substring(0,23);
    	$('.shopname').html(namenum + '...')
    }
	var on_off = "on";
	var timerout = null;
	var weburl = '{{env('WEB_URL')}}';
	$(".gotodown_appbtn").click(function(){
		phone=$("#gotodown_phonenum").val();
		//var myreg=/^(((13[0-9]{1})|(14[0-9]{1})|(17[0]{1})|(15[0-9]{1})|(18[0-9]{1}))+\d{8})$/;
		if(phone==""){
			$(".prompt").html("手机号码不能为空");return;
		}else if(phone.length!=11){
			$(".prompt").html("请输入有效的手机号码");return;
		} else {
			$(".prompt").html("");
			$.ajax({
				url : "/mobile/salesman/waituserbyuser/submit",
                type:'POST',
                data : $('form').serialize(),
                dataType:'json',
                async:false,
                success:function(data){
                    if (data.status == "success") {
                        window.location.href="/mobile/app/download";
                    } else {
                        alert(data.message);
                    }
                }
			})
		}
	})
	$("#getid_code").on("click",function(){
		clearTimeout(timerout)
		var mode = 1;
		if(on_off == "on") {
			var mobile=$("input[name='mobile']").val();
			if(mobile == ''||mobile.length!=11) {
			    $(".prompt").html("请输入有效的手机号码");return;
			}else{

				$.ajax({
		            url : "/mobile/register/captcha/get",
	                type:'POST',
	                data : {
	                    mobile:mobile,
	                    type: '4',
	                    mode: mode
	                    },
	                dataType:'json',
	                async:false,
	                success:function(data){
	                    if (data.status == "success") {
	                        // alert(data.message);
	                        $("#prompt_word").show();
	                        if(mode == 1) {
	                            $("#prompt_word").html("短信验证码发送成功");
	                        } else if(mode==2) {
                                $("#prompt_word").html("我们将以语音电话的形式告知您验证码，请注意接听来电。");
                            }
                            timerout = setTimeout(function(){
                                $("#prompt_word").hide();
                            },5000);
                            var seconds = 60;
                            on_off = "off";
                            var timer = setInterval(function(){
                                seconds = seconds-1;
                                if (seconds > 0){
                                    $("#getid_code").html(seconds+"秒");
                                }else{
                                    $("#getid_code").html("重新获取");
                                    clearInterval(timer);
                                    on_off = "on";
                                }
                            },1000)
	                    } else {
	                        alert(data.message);return;
	                    }
	               }
		        })
			}
		}else{
			$("#prompt_word").show();
			$("#prompt_word").html("验证码已发送，请耐心等待");
			var timerout = setTimeout(function(){
				$("#prompt_word").hide();
			},2000);
		}
	})
</script>
</body>
</html>